<%@ page contentType="text/html;charset=UTF-8"%>
<%@ page import="org.springside.modules.security.springsecurity.SpringSecurityUtils"%>
<%@ include file="/common/taglibs.jsp"%>
<script type="text/javascript">
<!--
	var setting = {
		view : {
			showIcon : false
		},
		async : {
			enable : true,
			url : "${ctx}/account/dept!getChildDepts.action",
			autoParam : [ "id" ],
			dataFilter : filter
		},
		callback : {
			beforeAsync : beforeAsync,
			onClick:onClick
		}
	};

	function filter(treeId, parentNode, childNodes) {
		if (!childNodes)
			return null;
		for ( var i = 0, l = childNodes.length; i < l; i++) {
			childNodes[i].name = childNodes[i].name.replace(/\.n/g, '.');
		}
		return childNodes;
	}
	
	function beforeAsync(treeId, treeNode) {
		return treeNode ? treeNode.level < 5 : true;
	}

	$(document).ready(function() {
		$.fn.zTree.init($("#deptTree"), setting);
	});
	
	function onClick(event, treeId, treeNode, clickFlag) {
		$("#rightContent").loadUrl(treeNode.path,{id:treeNode.id,pname:treeNode.name});
	}
	//-->
</script>

<div class="pageContent" style="padding:5px">
	<div class="tabs">
		<div class="tabsHeader">
			<div class="tabsHeaderContent">
				<ul>
					<li>
						<a href="javascript:;"><span>部门树</span> </a>
					</li>
				</ul>
			</div>
		</div>
		<div class="tabsContent" >
			<div>
				<div layoutH="50"
					style="float: left; display: block; overflow: auto; width: 200px; border: solid 1px #CCC; line-height: 21px; background: #fff">
					<ul id="deptTree" class="ztree"></ul>				
				</div>
				<div id="rightContent" class="unitBox" style="margin-left: 202px;">
				</div>
			</div>
		</div>
		<div class="tabsFooter">
			<div class="tabsFooterContent"></div>
		</div>
	</div>

</div>
